s = "a"

import sys

max_s = []
i = 0  # 窗口左开口
j = 1  # 窗口右开口

s = list(s)
for i in range(len(s)):
    for j in range(i, len(s)):
        if s[j] in s[i:j]:
            if len(max_s) < len(s[i:j]):
                max_s = s[i:j]
            break
        if j + 1 == len(s):
            if len(max_s) < len(s[i:j + 1]):
                max_s = s[i:j + 1]
            break

print(max_s)
